// 引入api请求
import { requestDetail } from '@/api'
const state = {
  detailList: {}
}
const mutations = {
  setDetailList(state, value) {
    state.detailList = value
  }
}
const actions = {
  async getDetailList({ commit }, skuId) {
    const res = await requestDetail(skuId)
    commit('setDetailList', res)
  }
}
const getters = {
  categoryView(state) {
    return state.detailList.categoryView || {}
  },
  spuSaleAttrList(state) {
    return state.detailList.spuSaleAttrList || []
  },
  skuInfo(state) {
    return state.detailList.skuInfo || {}
  },
}
// 暴漏模块 
export default {
  // 命名空间namespaced
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}